home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _1217F789F61E45E6BE74610C71F4E2BF < prev    next >
Encoding:
Text File  |  2004-01-06  |  18.9 KB  |  550 lines

  1. AutomaticElevator = {
  2.     Properties = {
  3.             bActive=1,
  4.           MapVisMask = 0,
  5.           Direction = {
  6.             X=0,
  7.           Y=0,
  8.             Z=1,
  9.           },
  10.           OpenDelay=1.5,
  11.           CloseDelay=1.5,
  12.           RetriggerDelay=1,
  13.           MovingDistance = 2,
  14.           MovingSpeed = 0.5,
  15.           bAutomatic = 1,
  16.           fileModel = "Objects/indoor/lift/lift.cgf",
  17.       fileStartSound = "Sounds/lifts/liftst.wav",
  18.       fileLoopSound = "Sounds/lifts/liftlp.wav",
  19.       fileStopSound = "Sounds/lifts/liftend.wav",
  20.       LoopSoundStart = 1.1,
  21.           WarnLight=
  22.           {
  23.               bHasWarnLight = 1,
  24.               fLightRadius=10,
  25.                 clrLightDiffuse={1, 0, 0},
  26.                 clrLightSpecular={1, 1, 1},
  27.                 LightAngles = {
  28.                   x=0,
  29.                   y=0,
  30.                   z=0,
  31.               },
  32.               fLightRotSpeed = 50,
  33.  
  34.             bProjectInAllDirs=0,
  35.             ProjectorFov=90,
  36.             texture_ProjectorTexture="Textures/projector.jpg",
  37.             shader_lightShader="",
  38.             bAffectsThisAreaOnly=1,
  39.             bUsedInRealTime=1,
  40.             bFakeLight=0,
  41.             bHeatSource=0,
  42.           },
  43.  
  44.         sMaterialDefault="m06_ben.Lift.reseach_lift_Default",
  45.         sMaterialUp="m06_ben.Lift.reseach_lift_UP",
  46.         sMaterialDown="m06_ben.Lift.reseach_lift_DOWN",
  47.       },
  48.   base=nil,
  49.   temp_vec={x=0,y=0,z=0},
  50.   base_pos={x=0,y=0,z=0},
  51.   Velocity={v={x=0,y=0,z=0}},
  52.   Distance = 0.0,
  53.   bOpeningDelay=nil,
  54.   bTriggerOpenRequest=nil,
  55.   bActive=1,
  56.  
  57.   MoveDir=1,
  58. }
  59.  
  60. function AutomaticElevator:OnSave(stm)
  61.     WriteToStream(stm,self.base_pos);
  62.     stm:WriteFloat(self.Distance);
  63. end
  64.  
  65. function AutomaticElevator:OnLoad(stm)    
  66.     self:OnPropertyChange();
  67.     self.base_pos=ReadFromStream(stm);    
  68.     self:SetPos(self.base_pos);
  69.     self.Distance=stm:ReadFloat();
  70. end
  71.  
  72. function AutomaticElevator:OnPropertyChange()
  73.     --System:Log("@@ELEVATOR["..self.id.."] x="..self.base.x..",y="..self.base.y..",z="..self.base.z)
  74.     self:OnReset();
  75.     if ( self.Properties.fileStartSound ~= self.CurrStartSound ) then
  76.         self.CurrStartSound=self.Properties.fileStartSound;
  77.         self.StartSound=Sound:Load3DSound(self.CurrStartSound);
  78.         Sound:SetSoundVolume(self.StartSound, 255);
  79.         Sound:SetMinMaxDistance(self.StartSound, 10, 30);
  80.     end
  81.     if ( self.Properties.fileLoopSound ~= self.CurrLoopSound ) then
  82.         self.CurrLoopSound=self.Properties.fileLoopSound;
  83.         self.LoopSound=Sound:Load3DSound(self.CurrLoopSound);
  84.         Sound:SetSoundLoop(self.LoopSound, 1);
  85.         Sound:SetSoundVolume(self.LoopSound, 255);
  86.         Sound:SetMinMaxDistance(self.LoopSound, 10, 30);
  87.     end
  88.     if ( self.Properties.fileStopSound ~= self.CurrStopSound ) then
  89.         self.CurrStopSound=self.Properties.fileStopSound;
  90.         self.StopSound=Sound:Load3DSound(self.CurrStopSound);
  91.         Sound:SetSoundVolume(self.StopSound, 255);
  92.         Sound:SetMinMaxDistance(self.StopSound, 10, 30);
  93.     end
  94. end
  95.  
  96. function AutomaticElevator:IsMovingClient(dt)
  97.  
  98.     --System:Log("Update");
  99.  
  100.     if (self.Properties.WarnLight.bHasWarnLight>0) then
  101.  
  102.         --System:Log("Light");
  103.  
  104.         local Pos=self:GetHelperPos("warnlight");
  105.         --local Pos=self:GetPos();
  106.         if (Pos) then
  107.             if (dt>5) then
  108.                 dt=0;
  109.             end
  110.             self.Properties.WarnLight.LightAngles.z=self.Properties.WarnLight.LightAngles.z+self.Properties.WarnLight.fLightRotSpeed*dt;
  111.             if (self.Properties.WarnLight.LightAngles.z>=360) then
  112.                 self.Properties.WarnLight.LightAngles.z=self.Properties.WarnLight.LightAngles.z-360;
  113.             end
  114.             if (self.Properties.WarnLight.LightAngles.z<0) then
  115.                 self.Properties.WarnLight.LightAngles.z=self.Properties.WarnLight.LightAngles.z+360;
  116.             end
  117.             --System:LogToConsole("LightPos("..Pos.x..", "..Pos.y..", "..Pos.z..")");
  118.             --System:LogToConsole("LightAng("..self.Properties.WarnLight.LightAngles.x..", "..self.Properties.WarnLight.LightAngles.y..", "..self.Properties.WarnLight.LightAngles.z..")");
  119.  
  120.             self:AddDynamicLight(    Pos,
  121.                         self.Properties.WarnLight.fLightRadius,
  122.                         self.Properties.WarnLight.clrLightDiffuse[1],
  123.                         self.Properties.WarnLight.clrLightDiffuse[2],
  124.                         self.Properties.WarnLight.clrLightDiffuse[3],
  125.                         1,
  126.                         self.Properties.WarnLight.clrLightSpecular[1],
  127.                         self.Properties.WarnLight.clrLightSpecular[2],
  128.                         self.Properties.WarnLight.clrLightSpecular[3],
  129.                         1,
  130.                         0,
  131.                         0, -- not used
  132.                         self.Properties.WarnLight.LightAngles,
  133.                         self.Properties.WarnLight.ProjectorFov,
  134.                         self.proj_tex_id,
  135.                         self.Properties.WarnLight.bAffectsThisAreaOnly,
  136.                         self.Properties.WarnLight.bUsedInRealTime,
  137.                         self.Properties.WarnLight.bHeatSource, 
  138.                         self.Properties.WarnLight.bFakeLight );
  139.  
  140.         else
  141.             System:Log("AutomaticElevator: warnlight helper is missing");
  142.         end
  143.     end
  144. end
  145.  
  146. function AutomaticElevator:OnReset()
  147.  
  148.     if(self.Properties.OpenDelay<=0)then
  149.         self.Properties.OpenDelay=0.001;
  150.     end
  151.     if(self.Properties.RetriggerDelay<=0)then
  152.         self.Properties.RetriggerDelay=0.001;
  153.     end
  154.     if (self.Properties.MovingDistance<0) then
  155.         self.Properties.MovingDistance=0;
  156.     end
  157.  
  158.     self.bActive=self.Properties.bActive;
  159.     self:LoadObject( self.Properties.fileModel, 0, 1 );
  160.     self:DrawObject( 0, 1 );
  161.     self:CreateRigidBody( 0, 0, -1 );
  162.     self:AwakePhysics(0);
  163.     self:SetUpdateType( eUT_Always );
  164. --    self.CurrOpenSound=self.Properties.fileOpenSound;
  165. --    self.OpenSound=Sound.Load3DSound(self.CurrOpenSound);
  166. --    self.CurrCloseSound=self.Properties.fileCloseSound;
  167. --    self.CloseSound=Sound.Load3DSound(self.CurrCloseSound);
  168. --    System.Log("$4SETTING DURINGLOADING 1 !!!");
  169.     
  170.     self.DuringLoading=1;
  171.     self:RegisterState("Idle");
  172.     self:RegisterState("Opening");
  173.     self:RegisterState("Closing");
  174.     self:GotoState("Idle");
  175.     self.DuringLoading=nil;
  176.  
  177.     if (self.Properties.MovingSpeed<0) then
  178.         self.MoveDir=-1;
  179.     else
  180.         self.MoveDir=1;
  181.     end
  182.     self:SetVelocity(0);
  183.     self.Distance=0;
  184.  
  185.     self.proj_tex_id = System:LoadTexture(self.Properties.WarnLight.texture_ProjectorTexture,1);
  186.     --System:LogToConsole("ProjId="..self.proj_tex_id);
  187.     
  188.     self:InitDynamicLight(self.Properties.WarnLight.texture_ProjectorTexture, self.Properties.WarnLight.shader_lightShader, 
  189.         self.Properties.WarnLight.bProjectInAllDirs,0);
  190.  
  191.     -- increase the bbox to match the elevator travel distance
  192.     --local bbox=self:GetBBox();
  193.     --local min=bbox.min;local max=bbox.max;
  194.     --max.x=max.x+self.Properties.Direction.X * self.Distance * self.MoveDir;
  195.     --max.y=max.y+self.Properties.Direction.Y * self.Distance * self.MoveDir;
  196.     --max.z=max.z+self.Properties.Direction.Z * self.Distance * self.MoveDir;
  197.     --self:SetBBox(min,max);
  198.  
  199. --    System.Log("$4SETTING DURINGLOADING NIL !!!");
  200. end
  201.  
  202. function AutomaticElevator:SetVelocity(Scale)
  203.     self.Velocity.v.x = self.Properties.Direction.X*self.Properties.MovingSpeed*Scale;
  204.     self.Velocity.v.y = self.Properties.Direction.Y*self.Properties.MovingSpeed*Scale;
  205.     self.Velocity.v.z = self.Properties.Direction.Z*self.Properties.MovingSpeed*Scale;
  206.     if (Scale==0) then
  207.         self:SetUpdateType( eUT_Always );    
  208.     else
  209.         self:AwakePhysics(1);
  210.         self:SetUpdateType( eUT_PhysicsPostStep );
  211.     end
  212.     --System:Log("Vel is "..self.Velocity.v.x..", "..self.Velocity.v.y..", "..self.Velocity.v.z);
  213. end
  214.  
  215. function AutomaticElevator:OnInit()
  216.     --self:OnReset();
  217.     self:OnPropertyChange();
  218.     self:NetPresent(nil);
  219.     self:EnableUpdate(0);
  220.     self:TrackColliders(1);
  221.     self.base_pos=new(self:GetPos());
  222. end
  223.  
  224. function AutomaticElevator:Event_Open(sender)
  225.  
  226.     
  227.         self:GotoState( "Opening" );
  228.         BroadcastEvent(self, "Open");
  229.     
  230.  
  231. end
  232.  
  233. function AutomaticElevator:Event_Close(sender)
  234.     self:GotoState( "Closing" );
  235.     BroadcastEvent(self, "Close");
  236. end
  237.  
  238. function AutomaticElevator:Event_Opened(sender)
  239.     BroadcastEvent(self, "Opened");
  240. end
  241.  
  242. function AutomaticElevator:Event_Closed(sender)
  243.     BroadcastEvent(self, "Closed");
  244. end
  245.  
  246. function AutomaticElevator:Event_Activate(sender)
  247.     self.bActive=1;
  248. end
  249.  
  250. function AutomaticElevator:Event_Deactivate(sender)
  251.     self.bActive=0;
  252. end
  253.  
  254. ------------------------------------------------------------------------------------------------------
  255. function AutomaticElevator:Event_ResetAnimation()
  256.     self:ResetAnimation(0);
  257. end
  258.  
  259. ------------------------------------------------------------------------------------------------------
  260. function AutomaticElevator:Event_StartAnimation(sender)
  261.     self:ResetAnimation(0);
  262.     self:StartAnimation( 0,"default",0,0,1,0 );    
  263.     self:SetAnimationSpeed( 1 );
  264. end
  265.  
  266. ------------------------------------------------------------------------------------------
  267. ------------------------------------------------------------------------------------------
  268. -- SERVER
  269. ------------------------------------------------------------------------------------------
  270. ------------------------------------------------------------------------------------------
  271. AutomaticElevator["Server"]={
  272.     OnInit = function(self) self.server=1; self:OnInit() end,
  273.     ------------------------------------------------------------------------------------------
  274.     --IDLE
  275.     ------------------------------------------------------------------------------------------
  276.     Idle = {
  277.         OnBeginState = function(self)
  278.             --System:Log("Idle");
  279.             self:EnableUpdate(0);
  280.             self:SetVelocity(0);
  281.             if (not self.InUpPos) then
  282.                 self.bOpeningDelay=nil;
  283.                 --self.base=new(self:GetPos());
  284.                 self.bTriggerOpenRequest=nil;
  285.             end
  286.  
  287.             self:SetMaterial(self.Properties.sMaterialDefault);
  288.         end,
  289.         OnEndState = function(self)
  290.             self:EnableUpdate(1);
  291.         end,
  292.         OnContact = function(self,other)
  293. --            if (not self.InUpPos) then
  294.             if(self.bActive==0 or (self.Properties.bAutomatic==0))then return end
  295.  
  296.             if ((not self.InUpPos) and (not self.WaitForDownDelay)) then
  297.                 if(self.bOpeningDelay==nil) then
  298.                     self:SetTimer(self.Properties.OpenDelay*1000);
  299.                     self.bOpeningDelay=1;
  300.                 end
  301.             end
  302.         end,
  303.         OnTimer = function(self)
  304.             if (not self.InUpPos) then
  305.                 if (not self.WaitForDownDelay) then
  306. --                    System.LogToConsole("!InUpPos");
  307.                     self:GotoState("Opening");
  308.                 end
  309. --            elseif (self.WaitForDownDelay) then
  310. --                System.LogToConsole("WaitForDownDelay");
  311. --                self.WaitForDownDelay=nil;
  312.             else
  313. --                System.LogToConsole("InUpPos");
  314.                 System:LogToConsole("Opened State Timer Exprired");
  315.                 self:GotoState( "Closing" );
  316.                 self:Event_Close(self);
  317.             end
  318.             self.InUpPos=nil;
  319.             self.WaitForDownDelay=nil;
  320.         end
  321.     },
  322.     ------------------------------------------------------------------------------------------
  323.     --OPENING
  324.     ------------------------------------------------------------------------------------------
  325.     Opening = {
  326.         -- Called when Opened State is Set.
  327.     ----------------------------------------------------------
  328.         OnBeginState = function(self)
  329.             System:LogToConsole("SERVER:Opened");
  330.             self.EventSent = nil;
  331.             self:SetVelocity(1);
  332.             self:SetMaterial(self.Properties.sMaterialUp);
  333.         end,
  334.     ----------------------------------------------------------
  335.         OnEndState = function(self)
  336.         end,
  337.     ----------------------------------------------------------
  338. --        OnTimer = function(self)
  339. --            System.LogToConsole("Opened State Timer Exprired");
  340. --            self.GotoState( "Closing" );
  341. --            self:Event_Close(self);
  342. --        end,
  343.     ----------------------------------------------------------
  344.         OnUpdate = function(self, dt)
  345.             self.Distance = self.Distance + abs (dt * self.Properties.MovingSpeed);
  346.  
  347.             if ( self.Distance > self.Properties.MovingDistance ) then
  348.  
  349.                 self.Distance = self.Properties.MovingDistance;
  350.  
  351.                 if ( not self.EventSent ) then
  352.                     self.Event_Opened(self);
  353.                     self.InUpPos=1;
  354.                     self:GotoState( "Idle" );
  355.                     --if closedelay if <= 0 the elevator will never close by himself
  356.                     if(self.Properties.bAutomatic~=0)then
  357.                         if(self.Properties.CloseDelay>0)then
  358.                             self:SetTimer(self.Properties.CloseDelay*1000);
  359.                         end
  360.                     end
  361.                 end
  362.                 self.EventSent = 1;
  363.             end
  364.  
  365.             self.temp_vec.x = self.Properties.Direction.X * self.Distance * self.MoveDir + self.base_pos.x;
  366.             self.temp_vec.y = self.Properties.Direction.Y * self.Distance * self.MoveDir + self.base_pos.y;
  367.             self.temp_vec.z = self.Properties.Direction.Z * self.Distance * self.MoveDir + self.base_pos.z;
  368.             --System:LogToConsole("basepos="..self.base_pos.x..","..self.base_pos.y..","..self.base_pos.z);
  369.             self:SetPos(self.temp_vec);
  370.             self:SetPhysicParams(PHYSICPARAM_VELOCITY, self.Velocity);
  371.             --self:SetObjectPos(0,self.temp_vec);
  372.         end,
  373.     ----------------------------------------------------------
  374.     },
  375.     ------------------------------------------------------------------------------------------
  376.     --CLOSING
  377.     ------------------------------------------------------------------------------------------
  378.     Closing = {
  379.         -- Called when Closed State is Set.
  380.         ----------------------------------------------------------
  381.         OnBeginState = function(self)
  382.             System:LogToConsole("SERVER:Closed");
  383.             self.EventSent = nil;
  384.             self:SetVelocity(-1);
  385.             self:SetMaterial(self.Properties.sMaterialDown);
  386.         end,
  387.         ----------------------------------------------------------
  388.         OnEndState = function(self)
  389.         end,
  390.         ----------------------------------------------------------
  391. --        OnTimer = function(self)
  392. --            self.GotoState("Idle");
  393. --        end,
  394.         ----------------------------------------------------------
  395.         OnUpdate = function(self, dt)
  396.             self.Distance = self.Distance - abs (dt * self.Properties.MovingSpeed);
  397.             if ( self.Distance < 0 ) then
  398.                 self.Distance = 0;
  399.                 if ( not self.EventSent ) then
  400.                     --System:Log("Server-EVENT-Closed");
  401.                     self:Event_Closed();
  402.                     self.WaitForDownDelay=1;
  403.                     self:GotoState( "Idle" );
  404.                     if(self.Properties.bAutomatic~=0)then
  405.                         --System:Log("Server-Closed");                        
  406.                         self:SetTimer(self.Properties.RetriggerDelay*1000);
  407.                     end
  408.                 end
  409.                 self.EventSent = 1;
  410.             end
  411.             --local CurrPos = {};
  412.             self.temp_vec.x = self.Properties.Direction.X * self.Distance * self.MoveDir + self.base_pos.x;
  413.             self.temp_vec.y = self.Properties.Direction.Y * self.Distance * self.MoveDir + self.base_pos.y;
  414.             self.temp_vec.z = self.Properties.Direction.Z * self.Distance * self.MoveDir + self.base_pos.z;
  415.             self:SetPos(self.temp_vec);
  416.             self:SetPhysicParams(PHYSICPARAM_VELOCITY, self.Velocity);
  417.             --self:SetObjectPos(0,self.temp_vec);
  418.         end,
  419.         ----------------------------------------------------------
  420.     }
  421. }
  422.  
  423. ------------------------------------------------------------------------------------------
  424. ------------------------------------------------------------------------------------------
  425. -- CLIENT
  426. ------------------------------------------------------------------------------------------
  427. ------------------------------------------------------------------------------------------
  428. AutomaticElevator["Client"]={
  429.     OnInit = AutomaticElevator.OnInit,
  430.     Idle = {
  431.         OnBeginState = function(self)
  432.             self:SetVelocity(0);
  433.             --if (self.Properties.WarnLight.bHasWarnLight>0) then
  434.             --    local Pos=self:GetHelperPos("warnlight");
  435.             --    if (Pos) then
  436.             --        System:ActivateMainLight(Pos, nil);
  437.             --    end
  438.             --end
  439.  
  440.             if (not self.DuringLoading) then
  441. --                System.Log("$4DURINGLOADING !!!");
  442.                 Sound:SetSoundPosition(self.StopSound, self:GetPos());
  443.                 Sound:PlaySound(self.StopSound);
  444.                 Sound:StopSound(self.LoopSound);
  445.                 Sound:StopSound(self.StartSound);
  446. --            else
  447. --                System.Log("$4NOT DURINGLOADING !!!");
  448.             end
  449.             self.LoopStarted=nil;
  450.         end
  451.     },
  452.     ------------------------------------------------------------------------------------------
  453.     --OPENED
  454.     ------------------------------------------------------------------------------------------
  455.     Opening = {
  456.         ----------------------------------------------------------
  457.         -- Called when Opened State is Set.
  458.         OnBeginState = function(self)
  459.             self:SetVelocity(1);
  460.             self:StartAnimation(0,"open");
  461.             System:LogToConsole("CLIENT:Open");
  462. --            Sound.SetSoundPosition(self.OpenSound, self.Base);
  463. --            Sound.PlaySound(self.OpenSound);
  464.             --if (self.Properties.WarnLight.bHasWarnLight>0) then
  465.             --    local Pos=self:GetHelperPos("warnlight");
  466.             --    if (Pos) then
  467.             --        System:ActivateMainLight(Pos, 1);
  468.             --    end
  469.             --end
  470.             Sound:SetSoundPosition(self.StartSound, self:GetPos());
  471.             Sound:PlaySound(self.StartSound);
  472.             self.StartMoveTime=_time;
  473.         end,
  474.         OnUpdate = function(self, dt)
  475.             if(not self.server)then
  476.                 self.Distance = self.Distance + abs (dt * self.Properties.MovingSpeed);
  477.                 if ( self.Distance > self.Properties.MovingDistance ) then
  478.                     self.Distance = self.Properties.MovingDistance;
  479.                 end
  480.                 
  481.                 --local CurrPos = {};
  482.                 self.temp_vec.x = self.Properties.Direction.X * self.Distance * self.MoveDir + self.base_pos.x;
  483.                 self.temp_vec.y = self.Properties.Direction.Y * self.Distance * self.MoveDir + self.base_pos.y;
  484.                 self.temp_vec.z = self.Properties.Direction.Z * self.Distance * self.MoveDir + self.base_pos.z;
  485.                 self:SetPos(self.temp_vec);
  486.                 self:SetPhysicParams(PHYSICPARAM_VELOCITY, self.Velocity);
  487.                 --self:SetObjectPos(0,self.temp_vec);
  488.             end
  489.             if ( ( _time - self.StartMoveTime ) >= self.Properties.LoopSoundStart ) then
  490.                 if (not self.LoopStarted) then
  491.                     Sound:PlaySound(self.LoopSound);
  492.                     self.LoopStarted=1;
  493.                 end
  494.             end
  495.             Sound:SetSoundPosition(self.StartSound, self:GetPos());
  496.             Sound:SetSoundPosition(self.LoopSound, self:GetPos());
  497.             self:IsMovingClient(dt);
  498.         end,
  499.     },
  500.     ------------------------------------------------------------------------------------------
  501.     --CLOSED
  502.     ------------------------------------------------------------------------------------------
  503.     Closing = {
  504.         -- Called when Closed State is Set.
  505.         ----------------------------------------------------------
  506.         OnBeginState = function(self)
  507.             self:SetVelocity(-1);
  508.             self:StartAnimation(0,"close");
  509.             System:LogToConsole("CLIENT:Close");
  510. --            Sound.SetSoundPosition(self.CloseSound, self.GetPos());
  511. --            Sound.PlaySound(self.CloseSound);
  512. --            if (self.Properties.WarnLight.bHasWarnLight>0) then
  513. --                local Pos=self:GetHelperPos("warnlight");
  514. --                if (Pos) then
  515. --                    System:ActivateMainLight(Pos, 1);
  516. --                end
  517. --            end
  518.             Sound:SetSoundPosition(self.StartSound, self:GetPos());
  519.             Sound:PlaySound(self.StartSound);
  520.             self.StartMoveTime=_time;
  521.         end,
  522.         OnUpdate = function(self, dt)
  523.             if(not self.server)then
  524.                 self.Distance = self.Distance - abs (dt * self.Properties.MovingSpeed);
  525.                 if ( self.Distance < 0 ) then
  526.                     self.Distance = 0;
  527.                 end
  528.                 --local CurrPos = {};
  529.                 self.temp_vec.x = self.Properties.Direction.X * self.Distance * self.MoveDir + self.base_pos.x;
  530.                 self.temp_vec.y = self.Properties.Direction.Y * self.Distance * self.MoveDir + self.base_pos.y;
  531.                 self.temp_vec.z = self.Properties.Direction.Z * self.Distance * self.MoveDir + self.base_pos.z;
  532.                 self:SetPos(self.temp_vec);
  533.                 self:SetPhysicParams(PHYSICPARAM_VELOCITY, self.Velocity);
  534.                 --self:SetObjectPos(0,self.temp_vec);
  535.             end
  536.             if ( ( _time - self.StartMoveTime ) >= self.Properties.LoopSoundStart ) then
  537.                 if (not self.LoopStarted) then
  538.                     Sound:PlaySound(self.LoopSound);
  539.                     self.LoopStarted=1;
  540.                 end
  541.             end
  542.             Sound:SetSoundPosition(self.StartSound, self:GetPos());
  543.             Sound:SetSoundPosition(self.LoopSound, self:GetPos());
  544.             self.IsMovingClient(self, dt);
  545.         end,
  546.     }
  547. }
  548. ------------------------------------------------------------------------------------------
  549. ------------------------------------------------------------------------------------------
  550.